import type { KeyBoardBtnGroup, KeyBoardType } from '../type'

export function getKeyBoardBtns(type: string): KeyBoardBtnGroup {
  switch (type as KeyBoardType) {
    case 'enzo6081':
      return getEnzo6081Btns()
    case '104':
      return get104Btns()
  }
}

// 恩卓6081 键盘
function getEnzo6081Btns(): KeyBoardBtnGroup {
  return [
    [
      { label: 'ESC', key: 1, width: 1, type: 'function' },
      { label: 'F1', key: 1, width: 1, offset: 1 },
      { label: 'F2', key: 1, width: 1 },
      { label: 'F3', key: 1, width: 1 },
      { label: 'F4', key: 1, width: 1 },
      { label: 'F5', key: 1, width: 1, offset: 1 },
      { label: 'F6', key: 1, width: 1 },
      { label: 'F7', key: 1, width: 1 },
      { label: 'F8', key: 1, width: 1 },
      { label: 'F9', key: 1, width: 1, offset: 1 },
      { label: 'F10', key: 1, width: 1 },
      { label: 'F11', key: 1, width: 1 },
      { label: 'F12', key: 1, width: 1 },
      { label: 'DEL', key: 1, width: 1, offset: 2, type: 'function' },
    ],
    [
      { label: '~', key: 1, width: 1, type: 'function' },
      { label: '1', key: 1, width: 1 },
      { label: '2', key: 1, width: 1 },
      { label: '3', key: 1, width: 1 },
      { label: '4', key: 1, width: 1 },
      { label: '5', key: 1, width: 1 },
      { label: '6', key: 1, width: 1 },
      { label: '7', key: 1, width: 1 },
      { label: '8', key: 1, width: 1 },
      { label: '9', key: 1, width: 1 },
      { label: '0', key: 1, width: 1 },
      { label: '-', key: 1, width: 1 },
      { label: '=', key: 1, width: 1 },
      { label: 'BACKSPACE', key: 1, width: 2, type: 'function' },
      { label: 'HOME', key: 1, width: 1, offset: 1, type: 'function' },
    ],
    [
      { label: 'TAB', key: 1, width: 1.5, type: 'function' },
      { label: 'Q', key: 1, width: 1 },
      { label: 'W', key: 1, width: 1 },
      { label: 'E', key: 1, width: 1 },
      { label: 'R', key: 1, width: 1 },
      { label: 'T', key: 1, width: 1 },
      { label: 'Y', key: 1, width: 1 },
      { label: 'U', key: 1, width: 1 },
      { label: 'I', key: 1, width: 1 },
      { label: 'O', key: 1, width: 1 },
      { label: 'P', key: 1, width: 1 },
      { label: '[', key: 1, width: 1 },
      { label: ']', key: 1, width: 1 },
      { label: '\\', key: 1, width: 1.5, type: 'function' },
      { label: 'PGUP', key: 1, width: 1, offset: 1, type: 'function' },
    ],
    [
      { label: 'CAPSLOCK', key: 1, width: 1.75, type: 'function' },
      { label: 'A', key: 1, width: 1 },
      { label: 'S', key: 1, width: 1 },
      { label: 'D', key: 1, width: 1 },
      { label: 'F', key: 1, width: 1 },
      { label: 'G', key: 1, width: 1 },
      { label: 'H', key: 1, width: 1 },
      { label: 'J', key: 1, width: 1 },
      { label: 'K', key: 1, width: 1 },
      { label: 'L', key: 1, width: 1 },
      { label: ';', key: 1, width: 1 },
      { label: '"', key: 1, width: 1 },
      { label: 'ENTER', key: 1, width: 2.45, type: 'function' },
      { label: 'PGDW', key: 1, width: 1, offset: 1, type: 'function' },
    ],
    [
      { label: 'SHIFT', key: 1, width: 2.25, type: 'function' },
      { label: 'Z', key: 1, width: 1 },
      { label: 'X', key: 1, width: 1 },
      { label: 'C', key: 1, width: 1 },
      { label: 'V', key: 1, width: 1 },
      { label: 'B', key: 1, width: 1 },
      { label: 'N', key: 1, width: 1 },
      { label: 'M', key: 1, width: 1 },
      { label: ',', key: 1, width: 1 },
      { label: '.', key: 1, width: 1 },
      { label: '/', key: 1, width: 1 },
      { label: 'SHIFT', key: 1, width: 1.95, type: 'function' },
      { label: '↑', key: 1, width: 1, offset: 1 },
    ],
    [
      { label: 'CTRL', key: 1, width: 1.25, type: 'function' },
      { label: 'WIN', key: 1, width: 1.25, type: 'function' },
      { label: 'ALT', key: 1, width: 1.25, type: 'function' },
      { label: ' ', key: 1, width: 7.25 },
      { label: 'ALT', key: 1, width: 1, type: 'function' },
      { label: 'FN', key: 1, width: 1, type: 'function' },
      { label: 'CTRL', key: 1, width: 1, type: 'function' },
      { label: '←', key: 1, width: 1, offset: 1 },
      { label: '↓', key: 1, width: 1 },
      { label: '→', key: 1, width: 1 },
    ],
  ]
}

// 常规104键盘
function get104Btns(): KeyBoardBtnGroup {
  return [
    [
      { label: 'ESC', key: 1, width: 1, type: 'function' },
      { label: 'F1', key: 1, width: 1, offset: 3.6 },
      { label: 'F2', key: 1, width: 1 },
      { label: 'F3', key: 1, width: 1 },
      { label: 'F4', key: 1, width: 1 },
      { label: 'F5', key: 1, width: 1, offset: 3.6 },
      { label: 'F6', key: 1, width: 1 },
      { label: 'F7', key: 1, width: 1 },
      { label: 'F8', key: 1, width: 1 },
      { label: 'F9', key: 1, width: 1, offset: 3.6 },
      { label: 'F10', key: 1, width: 1 },
      { label: 'F11', key: 1, width: 1 },
      { label: 'F12', key: 1, width: 1 },
    ],
    [
      { label: '~', key: 1, width: 1, type: 'function' },
      { label: '1', key: 1, width: 1 },
      { label: '2', key: 1, width: 1 },
      { label: '3', key: 1, width: 1 },
      { label: '4', key: 1, width: 1 },
      { label: '5', key: 1, width: 1 },
      { label: '6', key: 1, width: 1 },
      { label: '7', key: 1, width: 1 },
      { label: '8', key: 1, width: 1 },
      { label: '9', key: 1, width: 1 },
      { label: '0', key: 1, width: 1 },
      { label: '-', key: 1, width: 1 },
      { label: '=', key: 1, width: 1 },
      { label: 'BACKSPACE', key: 1, width: 2, type: 'function' },
      { label: 'HOME', key: 1, width: 1, offset: 1, type: 'function' },
    ],
    [
      { label: 'TAB', key: 1, width: 1.5, type: 'function' },
      { label: 'Q', key: 1, width: 1 },
      { label: 'W', key: 1, width: 1 },
      { label: 'E', key: 1, width: 1 },
      { label: 'R', key: 1, width: 1 },
      { label: 'T', key: 1, width: 1 },
      { label: 'Y', key: 1, width: 1 },
      { label: 'U', key: 1, width: 1 },
      { label: 'I', key: 1, width: 1 },
      { label: 'O', key: 1, width: 1 },
      { label: 'P', key: 1, width: 1 },
      { label: '[', key: 1, width: 1 },
      { label: ']', key: 1, width: 1 },
      { label: '\\', key: 1, width: 1.5, type: 'function' },
      { label: 'PGUP', key: 1, width: 1, offset: 1, type: 'function' },
    ],
    [
      { label: 'CAPSLOCK', key: 1, width: 1.75, type: 'function' },
      { label: 'A', key: 1, width: 1 },
      { label: 'S', key: 1, width: 1 },
      { label: 'D', key: 1, width: 1 },
      { label: 'F', key: 1, width: 1 },
      { label: 'G', key: 1, width: 1 },
      { label: 'H', key: 1, width: 1 },
      { label: 'J', key: 1, width: 1 },
      { label: 'K', key: 1, width: 1 },
      { label: 'L', key: 1, width: 1 },
      { label: ';', key: 1, width: 1 },
      { label: '"', key: 1, width: 1 },
      { label: 'ENTER', key: 1, width: 2.45, type: 'function' },
      { label: 'PGDW', key: 1, width: 1, offset: 1, type: 'function' },
    ],
    [
      { label: 'SHIFT', key: 1, width: 2.25, type: 'function' },
      { label: 'Z', key: 1, width: 1 },
      { label: 'X', key: 1, width: 1 },
      { label: 'C', key: 1, width: 1 },
      { label: 'V', key: 1, width: 1 },
      { label: 'B', key: 1, width: 1 },
      { label: 'N', key: 1, width: 1 },
      { label: 'M', key: 1, width: 1 },
      { label: ',', key: 1, width: 1 },
      { label: '.', key: 1, width: 1 },
      { label: '/', key: 1, width: 1 },
      { label: 'SHIFT', key: 1, width: 3.15, type: 'function' },
      { label: '↑', key: 1, width: 1, offset: 7.25 },
    ],
    [
      { label: 'CTRL', key: 1, width: 1.25, type: 'function' },
      { label: 'WIN', key: 1, width: 1.25, type: 'function' },
      { label: 'ALT', key: 1, width: 1.25, type: 'function' },
      { label: ' ', key: 1, width: 7.5 },
      { label: 'ALT', key: 1, width: 1.25, type: 'function' },
      { label: '', key: 1, width: 1.25, type: 'function' },
      { label: '', key: 1, width: 1.25, type: 'function' },
      { label: 'CTRL', key: 1, width: 1.25, type: 'function' },
      { label: '←', key: 1, width: 1, offset: 1 },
      { label: '↓', key: 1, width: 1 },
      { label: '→', key: 1, width: 1 },
    ],
  ]
}
